- content_for :head do
  = javascript_include_tag  'tiny_mce/tiny_mce.js'
  %script{:type => "text/javascript"}
    = "tinyMCE.init({"
    = '   mode : "textareas",'
    = '   theme : "advanced",'
    = '   plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",'
    = '   theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,image,|,forecolor,backcolor,",'
    = '   theme_advanced_buttons2 : "tablecontrols,code,",'
    = '   theme_advanced_buttons3 : "",'
    = '   theme_advanced_toolbar_location : "top",'
    = '   theme_advanced_toolbar_align : "left",'
    = '   height:"480",'
    = '   template_external_list_url : "/javascripts/tiny_mce/lists/template_list.js",'
    = '   external_link_list_url : "/javascripts/tiny_mce/lists/link_list.js",'
    = '   external_image_list_url : "/javascripts/tiny_mce/lists/image_list.js",'
    = '   media_external_list_url : "/javascripts/tiny_mce/lists/media_list.js",'
    = "});"
%table.new_page
  - form_for @page, :method => :put do |form| 
    %tr
      %td.field_title Title:
      %td.field
        = form.text_field :title
        = check_box_tag("page[title_is_invisible]", 1, @page.title_is_invisible?)
        Make it invisible?
      %td.error= error_message_on :page, :title
    %tr
      %td.field_title Short Description:
      %td.field= form.text_field :description
      %td.error= error_message_on :page, :description
    %tr
      %td.field_title Invisible?
      %td.field
        = check_box_tag("page[invisible]", 1, @page.invisible?)
        Won't show up in search results or anywhere else
    %tr
      %td.field_title Galleries:
      %td.field
        %select{:id => "page[gallery_ids][]", :name => "page[gallery_ids][]", :multiple => true, :size => 8, :width => 10}
          - @galleries.each do |gallery|
            %option{:value => gallery.id, :selected => ("selected" if @page.galleries.include?(gallery))}= gallery.name
    %tr
      %td.field_title Clients:
      %td.field
        = select_tag("page[user_ids][]", options_for_select(@users.collect { |cat| [cat.login, cat.id] }, @page.users.collect { |cat| cat.id}), {:multiple=>true, :size=>6})
    %tr
      %td.field_title Page Content:
      %td.field= form.text_area :content, :html => {:cols => "40", :rows => "100"}
      %td.error= error_message_on :page, :content
    %tr
      %td
      %td.submit= submit_tag 'update'
  - form_for @page, pages_url, :html => {:method => :delete} do |form|      
    %tr
      %td.field_title Delete:
      %td.field= submit_tag 'delete'